<div class="container">
  <section>
    <h2>
      <a ui-sref="app.reports"><i class="fa fa-angle-left"></i> 返回</a> 添加工作报告
    </h2>
    <form class="form" name="form" ng-submit="create(report)" novalidate>
      <br/>
      <fieldset>
        <div class="form-group" ng-class="{ 'has-success': form.title.$valid,
                                              'has-error': form.title.$invalid && submitted }">
          <label for="report_title">*报告标题</label>
          <input type="text" class="form-control" placeholder="填写报告标题" id="report_title" required ng-model="report.title" name="title" />
          <p class="help-block" ng-show="form.title.$error.required">
            <span class="text-danger"> 报告标题 为必填项目</span>
          </p>
        </div>

        <div class="form-group" ng-class="{ 'has-success': form.type.$valid && submitted,
                                          'has-error': form.type.$invalid && submitted }">
          <label>类型</label>
          <select name="type" class="form-control" ng-model="report.type" required>
            <option value="">---- 选择所属类型 ----</option>
            <option value="工作周报">工作周报</option>
            <option value="日常工作总结">日常工作总结</option>
            <option value="年度计划">年度计划</option>
          </select>
          <p class="help-block" ng-show="form.type.$error.required && submitted">
            类型为必填内容.
          </p>
        </div>

        <div class="form-group" ng-class="{ 'has-success': form.date.$valid,
                                              'has-error': form.date.$invalid && submitted }">
          <label for="report_date">*日期</label>
          <input type="text" id="report_date" class="form-control" datepicker-popup="yyyy-MM-dd" is-open="opened" ng-focus="opened = true" max-date="todayDate" name="date" ng-model="report.date" datepicker-options="dateOptions" ng-required="true" show-weeks="false" show-button-bar="false" toggle-weeks-text="周" current-text="今天" clear-text="清除" close-text="确定" />
          <p class="help-block" ng-show="form.date.$error.required">
            <span class="text-danger"> 日期 为必填项目</span>
          </p>
        </div>

        <div class="form-group" ng-class="{ 'has-success': form.body.$valid,
                                              'has-error': form.body.$invalid && submitted }">
          <label for="report_content">*报告内容</label>
          <textarea class="form-control" placeholder="填写工作报告内容" id="report_content" required ng-model="report.body" name="body" rows="5"></textarea>
          <p class="help-block" ng-show="form.body.$error.required">
            <span class="text-danger"> 报告内容 为必填项目</span>
          </p>
        </div>

        <div class="form-group" ng-class="{ 'has-success': form.plan.$valid,
                                              'has-error': form.plan.$invalid && submitted }">
          <label for="report_plan">*明日计划</label>
          <textarea class="form-control" placeholder="填写工作报告内容" id="report_plan" required ng-model="report.plan" name="plan" rows="5"></textarea>
          <p class="help-block" ng-show="form.plan.$error.required">
            <span class="text-danger"> 明日计划 为必填项目</span>
          </p>
        </div>

        <div class="form-group" ng-class="{ 'has-success': form.notes.$valid,
                                              'has-error': form.notes.$invalid && submitted }">
          <label for="report_notes">备注</label>
          <textarea class="form-control" placeholder="填写工作报告内容" id="report_notes" ng-model="report.notes" name="notes" rows="5"></textarea>
        </div>

        <button class="btn btn-primary btn-login" ng-disabled="form.$invalid" type="submit">
          添加
        </button>
      </fieldset>
    </form>
  </section>
</div>
